<template>
  <div>
    <h1>歌单详情页</h1>
    <h2>{{ playList.name }}</h2>
  </div>
</template>

<script>
// import { getPlayListDetail } from '@/api/song.js'
export default {
  data() {
    return {
      playList: []
    }
  },
  created() {
    this.getPlayListDetail(this.$route.query.id)
    // 第二种方法：用了api里的song.js的方法
    // getPlayListDetail(this.$route.query.id).then(res => {
    //   this.playList = res.data.playlist
    //   console.log(this.playList)
    // })
  },
  methods: {
    async getPlayListDetail(id) {
      const { data: res } = await this.$http.get('/playlist/detail', { params: { id } })
      this.playList = res.playlist
      console.log(res)
      //获取歌单名的第二种方法
      // const { data: res } = await this.$http.get('/playlist/detail?id=' + id)
    }
  },
  mounted() {}
}
</script>

<style></style>
